#pragma once
#include "cfcdef.h"
#include "cfcgl.h"
#include <vector>
using std::vector;
class CUIBuf
{
protected:
    Coord _size;
    Coord _pos;
    size_t _zIndex;
    size_t _dfn;
    static size_t DFN;
    vector<vector<Pixel>>_pxbuf;
    bool _visible;
public:
    CUIBuf();
    void Show(bool visible);
    void SetPos(Coord pos);
    Pixel& at(Coord pos);
    Pixel& operator[](Coord pos);
    bool operator >(const CUIBuf& b);
    bool operator <(const CUIBuf& b);

    void resize(Coord size);
    void SetzIndex(size_t zIndex);
    void ForceUpdate();
    void Update();
    ~CUIBuf();
    friend void cfcgl::UpdatePixel(Coord pos);
};

